-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise an exception when Pydantic plugin is enabled on Pydantic <2.5.0 #160
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
I'm not sure what the minimum supported version is, but it's definitely less than 2.7.0. |
I think it's 2.6.2 - need to check. |
I can only say that it hasn't worked with |
2.5.0 is the minimum version. |
2107534
to
997dfa8
Compare
logfire/_internal/config.py
Outdated
import pydantic | ||
|
||
# setuptools is a dependency of opentelemetry-instrumentation, we use it instead of adding "packaging" as a dependency. | ||
from setuptools._vendor.packaging.version import Version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like it if we had a util function which tried to import things from packaging
and then fell back to setuptools._vendor.packaging
, so that we use the proper module where possible. instrument_psycopg
could then also use that and we could remove the packaging
dep from the extra.
logfire/integrations/pydantic.py
Outdated
@@ -292,61 +291,68 @@ def get_schema_name(schema: CoreSchema) -> str: | |||
class LogfirePydanticPlugin: | |||
"""Implements a new API for pydantic plugins. | |||
|
|||
Patches pydantic to accept this new API shape. | |||
Patches Pydantic to accept this new API shape. | |||
|
|||
Set the `LOGFIRE_DISABLE_PYDANTIC_PLUGIN` environment variable to `true` to disable the plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the `LOGFIRE_DISABLE_PYDANTIC_PLUGIN` environment variable to `true` to disable the plugin. | |
Set the `LOGFIRE_DISABLE_PYDANTIC_PLUGIN` or `PYDANTIC_DISABLE_PLUGINS` environment variable to `true` to disable the plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I didn't do this, is because I'd have to explain that PYDANTIC_DISABLE_PLUGINS
disables all the plugins. I don't think it's necessary to do it here.
Co-authored-by: Alex Hall <alex.mojaki@gmail.com>
see https://pydanticlogfire.slack.com/archives/C06EDRBSAH3/p1714923558748049